﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:47
 ******************************************************************************/
//--------------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2012 , gt TECH, Ltd.
//--------------------------------------------------------------------

using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
     using RDIFramework.Utilities;

     /// <summary>
     /// CiDbLinkDefineEntity
     /// 数据库连接定义
     ///
     /// 修改纪录
     ///
     ///		2012-03-02 版本：1.0 EricHu 创建主键。
     ///
     /// 版本：1.0
     ///
     /// <author>
     ///		<name>EricHu</name>
     ///		<date>2012-03-02</date>
     /// </author>
     /// </summary>
    [Serializable]
    public partial class CiDbLinkDefineEntity
    {
        private int? id = null;
        /// <summary>
        /// 主键
        /// </summary>
        public int? Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        private String linkName = string.Empty;
        /// <summary>
        /// 数据库字符串连接的名称，程序中主要用这个名称来得到相应的连接字符串。
        /// </summary>
        public String LinkName
        {
            get
            {
                return this.linkName;
            }
            set
            {
                this.linkName = value;
            }
        }

        private String linkType = string.Empty;
        /// <summary>
        /// 数据库连接的类型（如连接类型为：sqlserver、oracle、db2、mysql、access等）
        /// </summary>
        public String LinkType
        {
            get
            {
                return this.linkType;
            }
            set
            {
                this.linkType = value;
            }
        }

        private String linkData = string.Empty;
        /// <summary>
        /// 连接字符串
        /// </summary>
        public String LinkData
        {
            get
            {
                return this.linkData;
            }
            set
            {
                this.linkData = value;
            }
        }

        private int? deleteMark = 0;
        /// <summary>
        /// 删除标志
        /// </summary>
        public int? DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        private int? sortCode = null;
        /// <summary>
        /// 排序码
        /// </summary>
        public int? SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }

        private int? enabled = 1;
        /// <summary>
        /// 有效
        /// </summary>
        public int? Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        private String description = string.Empty;
        /// <summary>
        /// 备注
        /// </summary>
        public String Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        private DateTime? createOn = DateTime.Now;
        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateOn
        {
            get
            {
                return this.createOn;
            }
            set
            {
                this.createOn = value;
            }
        }

        private int? createUserId = null;
        /// <summary>
        /// 创建用户主键
        /// </summary>
        public int? CreateUserId
        {
            get
            {
                return this.createUserId;
            }
            set
            {
                this.createUserId = value;
            }
        }

        private String createBy = string.Empty;
        /// <summary>
        /// 创建用户
        /// </summary>
        public String CreateBy
        {
            get
            {
                return this.createBy;
            }
            set
            {
                this.createBy = value;
            }
        }

        private DateTime? modifiedOn = null;
        /// <summary>
        /// 修改日期
        /// </summary>
        public DateTime? ModifiedOn
        {
            get
            {
                return this.modifiedOn;
            }
            set
            {
                this.modifiedOn = value;
            }
        }

        private int? modifyUserId = null;
        /// <summary>
        /// 修改用户主键
        /// </summary>
        public int? ModifyUserId
        {
            get
            {
                return this.modifyUserId;
            }
            set
            {
                this.modifyUserId = value;
            }
        }

        private String modifiedBy = string.Empty;
        /// <summary>
        /// 修改用户
        /// </summary>
        public String ModifiedBy
        {
            get
            {
                return this.modifiedBy;
            }
            set
            {
                this.modifiedBy = value;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public CiDbLinkDefineEntity()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public CiDbLinkDefineEntity(DataRow dataRow)
        {
            this.GetFrom(dataRow);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public CiDbLinkDefineEntity(IDataReader dataReader)
        {
            this.GetFrom(dataReader);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public CiDbLinkDefineEntity(DataTable dataTable)
        {
            this.GetFrom(dataTable);
        }

        /// <summary>
        /// 从数据表读取
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public CiDbLinkDefineEntity GetFrom(DataTable dataTable)
        {
            if ((dataTable == null) || (dataTable.Rows.Count == 0))
            {
                return null;
            }
            foreach (DataRow dataRow in dataTable.Rows)
            {
                this.GetFrom(dataRow);
                break;
            }
            return this;
        }

        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public CiDbLinkDefineEntity GetFrom(DataRow dataRow)
        {
            this.Id = BusinessLogic.ConvertToInt(dataRow[CiDbLinkDefineTable.FieldId]);
            this.LinkName = BusinessLogic.ConvertToString(dataRow[CiDbLinkDefineTable.FieldLinkName]);
            this.LinkType = BusinessLogic.ConvertToString(dataRow[CiDbLinkDefineTable.FieldLinkType]);
            this.LinkData = BusinessLogic.ConvertToString(dataRow[CiDbLinkDefineTable.FieldLinkData]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataRow[CiDbLinkDefineTable.FieldDeleteMark]);
            this.SortCode = BusinessLogic.ConvertToInt(dataRow[CiDbLinkDefineTable.FieldSortCode]);
            this.Enabled = BusinessLogic.ConvertToInt(dataRow[CiDbLinkDefineTable.FieldEnabled]);
            this.Description = BusinessLogic.ConvertToString(dataRow[CiDbLinkDefineTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[CiDbLinkDefineTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToInt(dataRow[CiDbLinkDefineTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataRow[CiDbLinkDefineTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataRow[CiDbLinkDefineTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToInt(dataRow[CiDbLinkDefineTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataRow[CiDbLinkDefineTable.FieldModifiedBy]);
            return this;
        }

        /// <summary>
        /// 从数据流读取
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public CiDbLinkDefineEntity GetFrom(IDataReader dataReader)
        {
            this.Id = BusinessLogic.ConvertToInt(dataReader[CiDbLinkDefineTable.FieldId]);
            this.LinkName = BusinessLogic.ConvertToString(dataReader[CiDbLinkDefineTable.FieldLinkName]);
            this.LinkType = BusinessLogic.ConvertToString(dataReader[CiDbLinkDefineTable.FieldLinkType]);
            this.LinkData = BusinessLogic.ConvertToString(dataReader[CiDbLinkDefineTable.FieldLinkData]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataReader[CiDbLinkDefineTable.FieldDeleteMark]);
            this.SortCode = BusinessLogic.ConvertToInt(dataReader[CiDbLinkDefineTable.FieldSortCode]);
            this.Enabled = BusinessLogic.ConvertToInt(dataReader[CiDbLinkDefineTable.FieldEnabled]);
            this.Description = BusinessLogic.ConvertToString(dataReader[CiDbLinkDefineTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[CiDbLinkDefineTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToInt(dataReader[CiDbLinkDefineTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataReader[CiDbLinkDefineTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataReader[CiDbLinkDefineTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToInt(dataReader[CiDbLinkDefineTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataReader[CiDbLinkDefineTable.FieldModifiedBy]);
            return this;
        }
    }
}
